package com.tledu.ssm.core;

import com.tledu.ssm.core.constants.ErrorCodeConstants;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author cyrus
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AjaxResult<T> {
    private Boolean success;
    private String msg;
    private Integer code;
    private T data;

    public AjaxResult(String msg, T data) {
        this.msg = msg;
        this.data = data;
        this.code = ErrorCodeConstants.SUCCESS;
        this.success = true;
    }

    public AjaxResult(String msg, Integer code, T data) {
        this.msg = msg;
        this.code = code;
        this.data = data;
        this.success = false;
    }
}
